/**
 * @author LKQ
 * @date 2022/2/24 16:08
 * @description 无法AC
 */
public class Solution {
    public static void main(String[] args) {

    }
    public int minDays(int n) {
        if(n <= 2) {
            return n;
        }
        int[] dp = new int[n + 1];
        dp[1] = 1;
        dp[2] = 2;
        dp[3] = 2;
        for(int i =4; i<= n; i++) {
            if(i % 3 == 0) {
                dp[i] = 1 + dp[i / 3];
            }else if(i % 2 ==0 && (i-1) % 3 ==0) {
                dp[i] = Math.min(1 + dp[i / 2], 1 + dp[i-1]);
            }else if(i % 2 == 0) {
                dp[i] = 1 + dp[i / 2];
            }else {
                dp[i] = 1 + dp[i - 1];
            }
        }
        return dp[n];
    }
}
